package main

import (
	"fmt"
	"os/exec"
)

func main() {
	var (
		cmdYes *exec.Cmd
		cmdNo  *exec.Cmd
		errYes error
		errNo  error
	)
	cmdYes = exec.Command("C:/Program Files/Git/bin/bash.exe", "-c", "echo hello,word;echo go ahead!")
	cmdNo = exec.Command("/bin/bash", "-c", "echo hello,word;echo go ahead!")
	errYes = cmdYes.Run()
	fmt.Println(cmdYes) //实际应该获取的是子进程的内容。这样打印并不是真正获得子进程的输出
	fmt.Println(cmdNo)
	errNo = cmdNo.Run()
	fmt.Println(errYes)
	fmt.Println(errNo)

}
